xquery version "1.0";

<results>
{     
    for $employee in
        doc("employees.xml")
        //row
       
    let 
        $gender := $employee/gender
        
    where
        $gender = "m"
        order by
        $employee/first_name
  
    return
        <id_gender>
        { 
            ($employee/first_name,$gender, hire_date, last_name)
        }        
        </id_gender>
}
</results>